/**
 * License under GNU's GPL 
 * AppointmentPage.java 
 */


import java.util.List;
import java.util.ArrayList;

/**
 * Class to hold all appointments together and generate an calender GUI
 * 
 * @author Team 9
 * @version 1.0
 * 
 */
public class AppointmentPage {
	/**
	 * Overrides the toString() method to print the appropriate instance
	 * variables
	 * 
	 * @return String to be printed
	 */
	@Override
	public String toString() {
		return "appointmentPage [appointmentArray=" + appointmentArray + "]";
	}

	/**
	 * arraylist to hold all the appointments together
	 */
	protected List<Appointment> appointmentArray = new ArrayList<Appointment>();

	/**
	 * Method to check if an appointment is available at given details
	 * 
	 * @param date
	 *            given date to check
	 * @param time
	 *            give time to check
	 * @param doctor
	 *            given doctor to check
	 * @return true, if spot available else false
	 */
	public boolean canRequestAppointment(String date, String time, String doctor) {
		final int size = appointmentArray.size();
		boolean b = true;
		for (int i = 0; i < size; i++) {
			//Appointment check = appointmentArray.get(i);
			// if (check.getDate().equalsIgnoreCase(date)
			// && check.getTime().equalsIgnoreCase(time)
			// && check.getDoctor().equalsIgnoreCase(doctor)) {
			System.out.println("Your Requested Appointment Is Unavailable");
			b = false;
		}
		// }
		if (b) {
			// final Appointment app = new Appointment(date, time, doctor);
			// appointmentArray.add(app);
			b = true;
		}
		return b;
	}

}
